.TH std::type_info::before 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::type_info::before \- std::type_info::before

.SH Synopsis
   bool before( const type_info& rhs ) const;           \fI(until C++11)\fP
   bool before( const type_info& rhs ) const noexcept;  \fI(since C++11)\fP

   Returns true if the type of this type_info precedes the type of rhs in the
   implementation's collation order. No guarantees are given; in particular, the
   collation order can change between the invocations of the same program.

.SH Parameters

   rhs - another type information object to compare to

.SH Return value

   true if the type of this type_info precedes the type of rhs in the implementation's
   collation order.

.SH Example


// Run this code

 #include <iostream>
 #include <typeinfo>

 int main()
 {
     if (typeid(int).before(typeid(char)))
         std::cout << "int goes before char in this implementation.\\n";
     else
         std::cout << "char goes before int in this implementation.\\n";
 }

.SH Possible output:

 char goes before int in this implementation.

.SH See also

   operator==         checks whether the objects refer to the same type
   operator!=         \fI(public member function)\fP
   (removed in C++20)
